package com.boarsoft.boar.office.entity;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.hibernate.validator.constraints.Range;

import com.boarsoft.boar.soagov.entity.SvcInfo;
import com.boarsoft.boar.sys.entity.SysUser;

/**
 * 
 * 
 * @author Mac_J
 */
public class OfficeWorkInfo implements Serializable {
	private static final long serialVersionUID = 1250040289364164550L;

	/** 未排期，未计划开始和结束时间 */
	public static final short STATUS_DRAFT = 1;
	/** 队列中，已提交，但未排期 */
	public static final short STATUS_QUEUED = 2;
	/** 已排期，未启动 */
	public static final short STATUS_PENDING = 3;
	/** 进行中 */
	public static final short STATUS_RUNNING = 4;
	/** 已完成 */
	public static final short STATUS_DONE = 5;
	/** 已取消 */
	public static final short STATUS_CANCEL = 6;
	/** 已关闭（归档） */
	public static final short STATUS_CLOSED = 7;

	protected String id;
	protected String parentId;
	protected String title;
	protected String url;
	protected short type;
	protected short priority;
	protected String memo;
	// @Pattern("")
	protected String planStartDate;
	protected String planEndDate;
	protected String actualStartDate;
	protected String actualEndDate;
	protected String ownerId;
	@Range(min = 0, max = 100)
	protected short progress;
	protected short status = STATUS_DRAFT;
	protected String lastTime;
	/** 在某个任务完成后开始做 */
	protected String afterWorkId;

	/** 与这个任务对应的工作流 */
	protected String flowId;
	/** 与这个任务对应的工作流实例 */
	protected String flowExeId;

	/** 当这个任务被提交时，要续跑的工作流 */
	protected String flowId2;
	/** 当这个任务被提交时，要续跑的工作流实例 */
	protected String flowExeId2;

	/** */
	protected Set<OfficeWorkInfo> preWorks;

	/** 不映射 */
	protected SysUser owner;
	/** 不映射 */
	protected Map<String, OfficeWorkLog> logs = new HashMap<String, OfficeWorkLog>();
	/** 不映射 */
	protected SvcInfo flow;

	/** 不映射 */
	protected Object ui;

	public void addLog(String date, OfficeWorkLog l) {
		logs.put(date, l);
	}

	// --------------------

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getParentId() {
		return parentId;
	}

	public short getType() {
		return type;
	}

	public void setType(short type) {
		this.type = type;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String getPlanStartDate() {
		return planStartDate;
	}

	public void setPlanStartDate(String planStartDate) {
		this.planStartDate = planStartDate;
	}

	public String getPlanEndDate() {
		return planEndDate;
	}

	public void setPlanEndDate(String planEndDate) {
		this.planEndDate = planEndDate;
	}

	public String getActualStartDate() {
		return actualStartDate;
	}

	public void setActualStartDate(String actualStartDate) {
		this.actualStartDate = actualStartDate;
	}

	public String getActualEndDate() {
		return actualEndDate;
	}

	public void setActualEndDate(String actualEndDate) {
		this.actualEndDate = actualEndDate;
	}

	public String getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(String ownerId) {
		this.ownerId = ownerId;
	}

	public short getProgress() {
		return progress;
	}

	public void setProgress(short progress) {
		this.progress = progress;
	}

	public short getStatus() {
		return status;
	}

	public void setStatus(short status) {
		this.status = status;
	}

	public String getLastTime() {
		return lastTime;
	}

	public void setLastTime(String lastTime) {
		this.lastTime = lastTime;
	}

	public short getPriority() {
		return priority;
	}

	public void setPriority(short priority) {
		this.priority = priority;
	}

	public SysUser getOwner() {
		return owner;
	}

	public void setOwner(SysUser owner) {
		this.owner = owner;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getAfterWorkId() {
		return afterWorkId;
	}

	public void setAfterWorkId(String afterWorkId) {
		this.afterWorkId = afterWorkId;
	}

	public Set<OfficeWorkInfo> getPreWorks() {
		return preWorks;
	}

	public void setPreWorks(Set<OfficeWorkInfo> preWorks) {
		this.preWorks = preWorks;
	}

	public Map<String, OfficeWorkLog> getLogs() {
		return logs;
	}

	public void setLogs(Map<String, OfficeWorkLog> logs) {
		this.logs = logs;
	}

	public String getFlowId() {
		return flowId;
	}

	public void setFlowId(String flowId) {
		this.flowId = flowId;
	}

	public String getFlowExeId() {
		return flowExeId;
	}

	public void setFlowExeId(String flowExeId) {
		this.flowExeId = flowExeId;
	}

	public SvcInfo getFlow() {
		return flow;
	}

	public void setFlow(SvcInfo flow) {
		this.flow = flow;
	}

	public Object getUi() {
		return ui;
	}

	public void setUi(Object ui) {
		this.ui = ui;
	}

	public String getFlowId2() {
		return flowId2;
	}

	public void setFlowId2(String flowId2) {
		this.flowId2 = flowId2;
	}

	public String getFlowExeId2() {
		return flowExeId2;
	}

	public void setFlowExeId2(String flowExeId2) {
		this.flowExeId2 = flowExeId2;
	}
}